<?php 
class OrderModel extends Model{
	
	public $table="ordertable";
	public $validate=array(
//	  array("bname","nonull","品牌名称不能为空",2,1),
	
	);
	
	
	public $auto=array(
	 array('time','time','function',2,3),
	 array('user_uid','_uid','method',2,3),

	);
	public function _uid(){
		return session('uid');
	}
	
	
	/**
	 * 添加
	 */
	public function addorder(){
		if(!$this->create()) return false;
		if(!K("Orderlist")->create()) {
			$this->error=K("Orderlist")->error;
			return false;
		}
		
		$this->data['status']="未付款";
		$this->data['addresss']=explode(',', $this->data['address']);
		$this->data['consignee']=$this->data['addresss'][1];
		$this->data['address']=$this->data['addresss'][0];
		$this->data['phone']=$this->data['addresss'][2];
		$this->data['total']=$_SESSION['cart']['total'];
//		p($this->data);die();
		$oid=$this->add();
		K("Orderlist")->addlist($oid);		
		return true;
		
	}
	
	
	
	
}



 ?>